package com.frame.work.frame.deal.base;

import com.alibaba.fastjson.JSONObject;
import lombok.Builder;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;

import java.util.Map;

/**
 * @author hewenze
 */
@Data
public class BaseFrame {
    private String gatewayMac;
    private String deviceMac;
    private String odIndex;
    private String deviceType;
    private String productType;
    private String dataType;
    private Object actions;

    public BaseFrame(String gatewayMac, String data) {
        this.setGatewayMac(gatewayMac);
        this.setDeviceMac(StringUtils.substring(data, 2, 18));
        this.setOdIndex(StringUtils.substring(data, 18, 22));
        this.setDeviceType(StringUtils.substring(data, 34, 36));
        this.setProductType(StringUtils.substring(data, 36, 38));
        this.setDataType(StringUtils.substring(data, 40, 42));
    }


    public BaseFrame() {

    }
}
